package com.xm.settlement.service.impl;

import com.baomidou.framework.service.impl.SuperServiceImpl;
import com.baomidou.mybatisplus.plugins.Page;
import com.xm.settlement.commons.utils.PageInfo;
import com.xm.settlement.mapper.AppShipManageMapper;
import com.xm.settlement.model.AppShipManage;
import com.xm.settlement.service.IAppShipManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2017/3/2.
 */
@Service
public class AppShipManageServiceImpl extends SuperServiceImpl<AppShipManageMapper,AppShipManage> implements IAppShipManageService {

    @Autowired
    private AppShipManageMapper appShipManageMapper;

    @Autowired
    private IAppShipManageService appShipManageService;

    @Override
    public void selectDataGrid(PageInfo pageInfo) {
        Page<AppShipManage> page = new Page<AppShipManage>(pageInfo.getNowpage(), pageInfo.getSize());
        List<AppShipManage> list = appShipManageMapper.selectAppShipManageList(page);
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
}

    @Override
    public void addShip(AppShipManage appShipManage) {
        appShipManage.setCreateId(appShipManage.getUpdateId());
        appShipManage.setCreateTime(new Date());
        appShipManage.setShipCode("F"+String.valueOf(System.currentTimeMillis()));
        appShipManageService.insert(appShipManage);
    }
}
